import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  //设置参数
  state: {
    isLogin:false,
    isReg:false,
    userInfo:null
  },
  //获取参数
  getters:{
    // 参数列表state指的是state数据
    getIsLogin(state){
      return state.isLogin;
    },
    getIsReg(state){
      return state.isReg;
    },
    getUserInfo(state){
      return state.userInfo
    }
  },
  //给参数添加的方法
  mutations: {
    showLogin(state,show){
      state.isLogin = show;
    },
    showReg(state,show){
      state.isReg = show;
    },
    hidenLR(state){
      state.isReg = false;
      state.isLogin = false;
  	},
    showUserInfo(state,userInfo){
      state.userInfo = userInfo;
    }
  },
  //通常跟api打交道
  actions: {
  	
  }
});
